package com.lagou.es.utils;

import lombok.extern.slf4j.Slf4j;

import java.sql.Connection;
import java.sql.DriverManager;

/**
 * @Description TODO
 * @Classname DBHelper
 * @Date 2021/8/26 0:37
 * @Author ch'ien
 */
@Slf4j
public class DBHelper {

    private static final String URL = "jdbc:mysql://192.168.172.130:3306/lagou_position?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai";
    private static final String DRIVER = "com.mysql.cj.jdbc.Driver";
    private static final String USER = "root";
    private static final String PASSWD = "123456";

    public static Connection conn = null;
    public static Connection getConn() {
        try {
            Class.forName(DRIVER);
            //获取连接
            conn = DriverManager.getConnection(URL, USER, PASSWD);
        } catch (Exception e) {
            log.error("mysql get connection error :{0}", e);
        }
        return conn;
    }

}
